import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:gourmet/color/hex.dart';
import 'package:gourmet/ui/accordion.dart';
import 'package:gourmet/utils/colors.dart';
import 'package:gourmet/utils/radian.dart';
import 'package:gourmet/utils/styles.dart';
import 'package:gourmet/utils/svg.dart';
import 'package:popup_menu_plus/popup_menu_plus.dart';

class OrderInfoPrepareController extends GetxController {
  final double navTop = 44 + Get.mediaQuery.padding.top;

  RxInt selectedIndex = RxInt(0);

  RxBool showAccordion = RxBool(false);

  final List<String> selecteds = [
    '点错菜、点多了',
    '计划有变，不想要了',
    '价格有点贵',
    '收货信息填写有误',
    '其他'
  ];

  final GlobalKey widgetKey = GlobalKey(debugLabel: 'widgetKey');

  PopupMenu? menu;
}

class OrderInfoPreparePage extends GetView<OrderInfoPrepareController> {
  const OrderInfoPreparePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: HexColor(ColorsUtils.colorF7f7),
      appBar: PreferredSize(
          preferredSize: Size.fromHeight(controller.navTop),
          child: AnnotatedRegion<SystemUiOverlayStyle>(
            value: SystemUiOverlayStyle.dark,
            child: Container(
              padding: EdgeInsets.only(top: Get.mediaQuery.padding.top),
              color: HexColor(ColorsUtils.colorF7f7),
              height: controller.navTop,
              child: Row(
                children: [
                  GestureDetector(
                    onTap: Get.back,
                    child: Container(
                      width: 40,
                      alignment: Alignment.center,
                      child: Icon(
                        CupertinoIcons.chevron_back,
                        color: HexColor(ColorsUtils.color0000),
                        size: 18,
                      ),
                    ),
                  ),
                  Expanded(
                      child: Center(
                    child: Text(
                      '订单详情',
                      style: StylesUtils.customTextStyle(
                          fontSize: StylesUtils.fontSize16,
                          color: ColorsUtils.color0000,
                          fontWeight: FontWeight.w700),
                    ),
                  )),
                  GestureDetector(
                    key: controller.widgetKey,
                    onTap: () {
                      openMenu(context);
                    },
                    child: Container(
                      width: 40,
                      alignment: Alignment.center,
                      child: Icon(
                        CupertinoIcons.ellipsis,
                        color: HexColor(ColorsUtils.color0000),
                        size: 18,
                      ),
                    ),
                  )
                ],
              ),
            ),
          )),
      body: SingleChildScrollView(
        padding: const EdgeInsets.only(bottom: 20),
        child: Column(
          children: [
            Container(
              margin: EdgeInsets.only(left: (Get.width - 345) / 2),
              width: 345,
              height: 130,
              padding: const EdgeInsets.only(top: 10),
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(10)),
              child: Column(
                children: [
                  Center(
                    child: Text.rich(TextSpan(children: [
                      TextSpan(
                          text: '待接单商家 ',
                          style: StylesUtils.customTextStyle(
                              fontSize: StylesUtils.fontSize18,
                              color: ColorsUtils.color0000)),
                      WidgetSpan(
                          child: Icon(
                            CupertinoIcons.chevron_forward,
                            size: 14,
                            color: HexColor(ColorsUtils.color9999),
                          ),
                          alignment: PlaceholderAlignment.middle),
                    ])),
                  ),
                  Container(
                    height: 40,
                    alignment: Alignment.center,
                    child: Text(
                      '订单已付款，请耐心等待商家接单',
                      softWrap: true,
                      style: StylesUtils.customTextStyle(
                          color: ColorsUtils.color7979),
                    ),
                  ),
                  Center(
                    child: TextButton(
                        onPressed: cancelOrder,
                        style: ButtonStyle(
                            fixedSize:
                                const WidgetStatePropertyAll(Size(105, 35)),
                            minimumSize:
                                const WidgetStatePropertyAll(Size(105, 35)),
                            backgroundColor: const WidgetStatePropertyAll(
                                Colors.transparent),
                            overlayColor: const WidgetStatePropertyAll(
                                Colors.transparent),
                            shape: WidgetStatePropertyAll(
                                RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(18),
                                    side: BorderSide(
                                        color:
                                            HexColor(ColorsUtils.colorFf64)))),
                            alignment: Alignment.center),
                        child: Text(
                          '取消订单',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.colorFf64),
                        )),
                  )
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(left: (Get.width - 345) / 2, top: 10),
              width: 345,
              padding: const EdgeInsets.only(top: 15, left: 20, right: 15),
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(10)),
              child: Column(
                children: [
                  Container(
                    alignment: Alignment.centerLeft,
                    child: Wrap(
                      spacing: 15,
                      alignment: WrapAlignment.start,
                      crossAxisAlignment: WrapCrossAlignment.center,
                      children: [
                        Image.network(
                          'https://img2.baidu.com/it/u=925468304,3986454037&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=510',
                          width: 40,
                          height: 40,
                          fit: BoxFit.fill,
                        ),
                        Text.rich(TextSpan(children: [
                          TextSpan(
                              text: '华莱士-凤凰广场2店 ',
                              style: StylesUtils.customTextStyle(
                                  fontSize: StylesUtils.fontSize16,
                                  color: ColorsUtils.color0000,
                                  fontWeight: FontWeight.w700)),
                          WidgetSpan(
                              child: Icon(
                                CupertinoIcons.chevron_forward,
                                size: 12,
                                color: HexColor(ColorsUtils.color9999),
                              ),
                              alignment: PlaceholderAlignment.middle)
                        ]))
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.symmetric(vertical: 10),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Image.network(
                          'https://img1.baidu.com/it/u=1256018187,1616427226&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500',
                          width: 60,
                          height: 60,
                          fit: BoxFit.fill,
                        ),
                        Expanded(
                            child: Padding(
                          padding: const EdgeInsets.only(left: 10),
                          child: Column(
                            children: [
                              Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '香辣鸡块汉堡包',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize16,
                                        color: ColorsUtils.color0000),
                                  ),
                                  Wrap(
                                    spacing: 15,
                                    alignment: WrapAlignment.end,
                                    crossAxisAlignment:
                                        WrapCrossAlignment.center,
                                    children: [
                                      Text(
                                        '￥30',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color9999,
                                            fontSize: StylesUtils.fontSize16,
                                            decoration:
                                                TextDecoration.lineThrough,
                                            decorationColor:
                                                HexColor(ColorsUtils.color9999),
                                            decorationThickness: 1,
                                            decorationStyle:
                                                TextDecorationStyle.solid),
                                      ),
                                      Text(
                                        '￥25',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: StylesUtils.fontSize16,
                                            fontWeight: FontWeight.w700,
                                            color: ColorsUtils.color0000),
                                      ),
                                    ],
                                  )
                                ],
                              ),
                              Container(
                                margin: const EdgeInsets.only(top: 20),
                                alignment: Alignment.centerLeft,
                                child: Text(
                                  'x1',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color0000,
                                      fontSize: StylesUtils.fontSize16),
                                ),
                              ),
                            ],
                          ),
                        )),
                      ],
                    ),
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Image.network(
                        'https://img2.baidu.com/it/u=1424725757,1067373029&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
                        width: 60,
                        height: 60,
                        fit: BoxFit.fill,
                      ),
                      Expanded(
                          child: Padding(
                        padding: const EdgeInsets.only(left: 10),
                        child: Column(
                          children: [
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Text(
                                  '百事可乐（中杯）',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize16,
                                      color: ColorsUtils.color0000),
                                ),
                                Text(
                                  '￥8',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize16,
                                      fontWeight: FontWeight.w700,
                                      color: ColorsUtils.color0000),
                                ),
                              ],
                            ),
                            Container(
                              margin: const EdgeInsets.only(top: 20),
                              alignment: Alignment.centerLeft,
                              child: Text(
                                'x1',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color0000,
                                    fontSize: StylesUtils.fontSize16),
                              ),
                            ),
                          ],
                        ),
                      )),
                    ],
                  ),
                  Padding(
                    padding: const EdgeInsets.only(top: 10),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Image.network(
                          'https://img0.baidu.com/it/u=3968955522,201643974&fm=253&fmt=auto&app=138&f=PNG?w=712&h=500',
                          width: 60,
                          height: 60,
                          fit: BoxFit.fill,
                        ),
                        Expanded(
                            child: Padding(
                          padding: const EdgeInsets.only(left: 10),
                          child: Column(
                            children: [
                              Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '香辣鸡翅',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize16,
                                        color: ColorsUtils.color0000),
                                  ),
                                  Text(
                                    '￥18',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize16,
                                        fontWeight: FontWeight.w700,
                                        color: ColorsUtils.color0000),
                                  ),
                                ],
                              ),
                              Container(
                                margin: const EdgeInsets.only(top: 20),
                                alignment: Alignment.centerLeft,
                                child: Text(
                                  'x1',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color0000,
                                      fontSize: StylesUtils.fontSize16),
                                ),
                              ),
                            ],
                          ),
                        )),
                      ],
                    ),
                  ),
                  Obx(() => Accordion(
                        showAccordion: controller.showAccordion.value,
                        titleChild: Container(
                          margin: const EdgeInsets.only(top: 10),
                          constraints: const BoxConstraints.expand(
                              width: 70, height: 25),
                          alignment: Alignment.center,
                          decoration: BoxDecoration(
                              color: HexColor(ColorsUtils.colorF5f5),
                              borderRadius: BorderRadius.circular(13)),
                          child: Text.rich(TextSpan(children: [
                            TextSpan(
                                text: '共6件',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color7979,
                                    fontSize: StylesUtils.fontSize13)),
                            WidgetSpan(
                                child: Icon(
                              controller.showAccordion.isTrue
                                  ? CupertinoIcons.chevron_up
                                  : CupertinoIcons.chevron_down,
                              size: 14,
                              color: HexColor(ColorsUtils.color9999),
                            ))
                          ])),
                        ),
                        contentChild: Column(
                          children: [
                            Padding(
                              padding: const EdgeInsets.only(top: 10),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Image.network(
                                    'https://img1.baidu.com/it/u=553688201,1753261999&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375',
                                    width: 60,
                                    height: 60,
                                    fit: BoxFit.fill,
                                  ),
                                  Expanded(
                                      child: Padding(
                                    padding: const EdgeInsets.only(left: 10),
                                    child: Column(
                                      children: [
                                        Row(
                                          mainAxisAlignment:
                                              MainAxisAlignment.spaceBetween,
                                          children: [
                                            Text(
                                              '香辣烤肉串',
                                              style:
                                                  StylesUtils.customTextStyle(
                                                      fontSize: StylesUtils
                                                          .fontSize16,
                                                      color: ColorsUtils
                                                          .color0000),
                                            ),
                                            Text(
                                              '￥18',
                                              style:
                                                  StylesUtils.customTextStyle(
                                                      fontSize: StylesUtils
                                                          .fontSize16,
                                                      fontWeight:
                                                          FontWeight.w700,
                                                      color: ColorsUtils
                                                          .color0000),
                                            ),
                                          ],
                                        ),
                                        Container(
                                          margin:
                                              const EdgeInsets.only(top: 20),
                                          alignment: Alignment.centerLeft,
                                          child: Text(
                                            'x1',
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.color0000,
                                                fontSize:
                                                    StylesUtils.fontSize16),
                                          ),
                                        ),
                                      ],
                                    ),
                                  )),
                                ],
                              ),
                            ),
                            Padding(
                              padding: const EdgeInsets.only(top: 10),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Image.network(
                                    'https://img0.baidu.com/it/u=2891150709,633736510&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
                                    width: 60,
                                    height: 60,
                                    fit: BoxFit.fill,
                                  ),
                                  Expanded(
                                      child: Padding(
                                    padding: const EdgeInsets.only(left: 10),
                                    child: Column(
                                      children: [
                                        Row(
                                          mainAxisAlignment:
                                              MainAxisAlignment.spaceBetween,
                                          children: [
                                            Text(
                                              '吉羊鲜礼生鲜原味羊肉串',
                                              style:
                                                  StylesUtils.customTextStyle(
                                                      fontSize: StylesUtils
                                                          .fontSize16,
                                                      color: ColorsUtils
                                                          .color0000),
                                            ),
                                            Text(
                                              '￥28',
                                              style:
                                                  StylesUtils.customTextStyle(
                                                      fontSize: StylesUtils
                                                          .fontSize16,
                                                      fontWeight:
                                                          FontWeight.w700,
                                                      color: ColorsUtils
                                                          .color0000),
                                            ),
                                          ],
                                        ),
                                        Container(
                                          margin:
                                              const EdgeInsets.only(top: 20),
                                          alignment: Alignment.centerLeft,
                                          child: Text(
                                            'x1',
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.color0000,
                                                fontSize:
                                                    StylesUtils.fontSize16),
                                          ),
                                        ),
                                      ],
                                    ),
                                  )),
                                ],
                              ),
                            ),
                            Padding(
                              padding: const EdgeInsets.only(top: 10),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Image.network(
                                    'https://img0.baidu.com/it/u=928376665,305637941&fm=253&fmt=auto&app=138&f=JPEG?w=578&h=500',
                                    width: 60,
                                    height: 60,
                                    fit: BoxFit.fill,
                                  ),
                                  Expanded(
                                      child: Padding(
                                    padding: const EdgeInsets.only(left: 10),
                                    child: Column(
                                      children: [
                                        Row(
                                          mainAxisAlignment:
                                              MainAxisAlignment.spaceBetween,
                                          children: [
                                            Text(
                                              '美味烤鸭',
                                              style:
                                                  StylesUtils.customTextStyle(
                                                      fontSize: StylesUtils
                                                          .fontSize16,
                                                      color: ColorsUtils
                                                          .color0000),
                                            ),
                                            Text(
                                              '￥28',
                                              style:
                                                  StylesUtils.customTextStyle(
                                                      fontSize: StylesUtils
                                                          .fontSize16,
                                                      fontWeight:
                                                          FontWeight.w700,
                                                      color: ColorsUtils
                                                          .color0000),
                                            ),
                                          ],
                                        ),
                                        Container(
                                          margin:
                                              const EdgeInsets.only(top: 20),
                                          alignment: Alignment.centerLeft,
                                          child: Text(
                                            'x1',
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.color0000,
                                                fontSize:
                                                    StylesUtils.fontSize16),
                                          ),
                                        ),
                                      ],
                                    ),
                                  )),
                                ],
                              ),
                            ),
                          ],
                        ),
                        onToggleCollapsed: (bool col) {
                          controller.showAccordion.value = col;
                        },
                      )),
                  Padding(
                    padding:
                        const EdgeInsets.symmetric(vertical: 10, horizontal: 5),
                    child: Container(
                      height: 2,
                      color: HexColor(ColorsUtils.colorF5f5),
                    ),
                  ),
                  Container(
                    height: 40,
                    alignment: Alignment.center,
                    child: Text.rich(TextSpan(children: [
                      WidgetSpan(
                          child: Icon(
                            CupertinoIcons.phone_fill,
                            size: 18,
                            color: HexColor(ColorsUtils.colorFf64),
                          ),
                          alignment: PlaceholderAlignment.middle),
                      TextSpan(
                          text: '联系商家',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.colorFf64,
                              fontSize: StylesUtils.fontSize16))
                    ])),
                  )
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(left: (Get.width - 345) / 2, top: 10),
              width: 345,
              padding: const EdgeInsets.all(15),
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(10)),
              child: Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text(
                          '商品总价',
                          style: StylesUtils.customTextStyle(
                              fontSize: StylesUtils.fontSize15,
                              color: ColorsUtils.color7979),
                        ),
                        Text(
                          '￥101',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color0000,
                            fontSize: StylesUtils.fontSize16,
                            fontWeight: FontWeight.w700,
                          ),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text(
                          '打包费',
                          style: StylesUtils.customTextStyle(
                              fontSize: StylesUtils.fontSize15,
                              color: ColorsUtils.color7979),
                        ),
                        Text(
                          '￥6',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color0000,
                            fontSize: StylesUtils.fontSize16,
                            fontWeight: FontWeight.w700,
                          ),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text(
                          '配送费',
                          style: StylesUtils.customTextStyle(
                              fontSize: StylesUtils.fontSize15,
                              color: ColorsUtils.color7979),
                        ),
                        Text(
                          '￥4',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color0000,
                            fontSize: StylesUtils.fontSize16,
                            fontWeight: FontWeight.w700,
                          ),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text.rich(TextSpan(children: [
                          WidgetSpan(
                              child: Container(
                                constraints: const BoxConstraints.expand(
                                    width: 16, height: 16),
                                alignment: Alignment.center,
                                decoration: BoxDecoration(
                                    borderRadius: BorderRadius.circular(2),
                                    gradient: LinearGradient(
                                        //linear-gradient(90deg, rgba(255, 110, 83, 1) 0%, rgba(255, 110, 83, 1) 0%, rgba(255, 84, 53, 1) 100%, rgba(255, 84, 53, 1) 100%)
                                        colors: [
                                          ColorsUtils.rgba(255, 110, 83, 1),
                                          ColorsUtils.rgba(255, 110, 83, 1),
                                          ColorsUtils.rgba(255, 84, 53, 1),
                                          ColorsUtils.rgba(255, 84, 53, 1)
                                        ],
                                        stops: const [
                                          0,
                                          0,
                                          1,
                                          1
                                        ],
                                        transform: GradientRotation(
                                            RadianUtils.angleToRadian(90)))),
                                child: Text(
                                  '减',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize11),
                                ),
                              ),
                              alignment: PlaceholderAlignment.middle),
                          TextSpan(
                            text: ' 店铺满50减3',
                            style: StylesUtils.customTextStyle(
                                fontSize: StylesUtils.fontSize15,
                                color: ColorsUtils.color7979),
                          ),
                        ])),
                        Text(
                          '-￥3',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.colorFf64,
                            fontSize: StylesUtils.fontSize16,
                            fontWeight: FontWeight.w700,
                          ),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text.rich(TextSpan(children: [
                          WidgetSpan(
                              child: SvgUtils.assetName('u1856',
                                  width: 15, height: 16),
                              alignment: PlaceholderAlignment.middle),
                          TextSpan(
                            text: ' 平台红包',
                            style: StylesUtils.customTextStyle(
                                fontSize: StylesUtils.fontSize15,
                                color: ColorsUtils.color7979),
                          )
                        ])),
                        Text(
                          '-￥2',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.colorFf64,
                            fontSize: StylesUtils.fontSize16,
                            fontWeight: FontWeight.w700,
                          ),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text.rich(TextSpan(children: [
                          WidgetSpan(
                              child: Container(
                                constraints: const BoxConstraints.expand(
                                    width: 16, height: 16),
                                alignment: Alignment.center,
                                decoration: BoxDecoration(
                                    borderRadius: BorderRadius.circular(2),
                                    gradient: LinearGradient(
                                        //linear-gradient(90deg, rgba(255, 110, 83, 1) 0%, rgba(255, 110, 83, 1) 0%, rgba(255, 84, 53, 1) 100%, rgba(255, 84, 53, 1) 100%)
                                        colors: [
                                          ColorsUtils.rgba(255, 110, 83, 1),
                                          ColorsUtils.rgba(255, 110, 83, 1),
                                          ColorsUtils.rgba(255, 84, 53, 1),
                                          ColorsUtils.rgba(255, 84, 53, 1)
                                        ],
                                        stops: const [
                                          0,
                                          0,
                                          1,
                                          1
                                        ],
                                        transform: GradientRotation(
                                            RadianUtils.angleToRadian(90)))),
                                child: Text(
                                  '券',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize11),
                                ),
                              ),
                              alignment: PlaceholderAlignment.middle),
                          TextSpan(
                            text: ' 商家代金券',
                            style: StylesUtils.customTextStyle(
                                fontSize: StylesUtils.fontSize15,
                                color: ColorsUtils.color7979),
                          ),
                        ])),
                        Text(
                          '-￥2',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.colorFf64,
                            fontSize: StylesUtils.fontSize16,
                            fontWeight: FontWeight.w700,
                          ),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text.rich(TextSpan(children: [
                          WidgetSpan(
                              child: Container(
                                constraints: const BoxConstraints.expand(
                                    width: 16, height: 16),
                                alignment: Alignment.center,
                                decoration: BoxDecoration(
                                    borderRadius: BorderRadius.circular(2),
                                    gradient: LinearGradient(
                                        //linear-gradient(90deg, rgba(0, 102, 255, 1) 0%, rgba(0, 102, 255, 1) 0%, rgba(0, 153, 255, 1) 100%, rgba(0, 153, 255, 1) 100%)
                                        colors: [
                                          ColorsUtils.rgba(0, 102, 255, 1),
                                          ColorsUtils.rgba(0, 102, 255, 1),
                                          ColorsUtils.rgba(0, 153, 255, 1),
                                          ColorsUtils.rgba(0, 153, 255, 1)
                                        ],
                                        stops: const [
                                          0,
                                          0,
                                          1,
                                          1
                                        ],
                                        transform: GradientRotation(
                                            RadianUtils.angleToRadian(90)))),
                                child: Text(
                                  '返',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize11),
                                ),
                              ),
                              alignment: PlaceholderAlignment.middle),
                          TextSpan(
                            text: ' 店铺满50返2',
                            style: StylesUtils.customTextStyle(
                                fontSize: StylesUtils.fontSize15,
                                color: ColorsUtils.color7979),
                          ),
                        ])),
                        Text(
                          '返￥2',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.colorFf64,
                            fontSize: StylesUtils.fontSize16,
                            fontWeight: FontWeight.w700,
                          ),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text.rich(TextSpan(children: [
                          WidgetSpan(
                              child: Container(
                                constraints: const BoxConstraints.expand(
                                    width: 16, height: 16),
                                alignment: Alignment.center,
                                decoration: BoxDecoration(
                                    borderRadius: BorderRadius.circular(2),
                                    gradient: LinearGradient(
                                        //linear-gradient(90deg, rgba(0, 102, 255, 1) 0%, rgba(0, 102, 255, 1) 0%, rgba(0, 153, 255, 1) 100%, rgba(0, 153, 255, 1) 100%)
                                        colors: [
                                          ColorsUtils.rgba(0, 102, 255, 1),
                                          ColorsUtils.rgba(0, 102, 255, 1),
                                          ColorsUtils.rgba(0, 153, 255, 1),
                                          ColorsUtils.rgba(0, 153, 255, 1)
                                        ],
                                        stops: const [
                                          0,
                                          0,
                                          1,
                                          1
                                        ],
                                        transform: GradientRotation(
                                            RadianUtils.angleToRadian(90)))),
                                child: Text(
                                  '返',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize11),
                                ),
                              ),
                              alignment: PlaceholderAlignment.middle),
                          TextSpan(
                            text: ' 店铺满50赠送苹果',
                            style: StylesUtils.customTextStyle(
                                fontSize: StylesUtils.fontSize15,
                                color: ColorsUtils.color7979),
                          ),
                        ])),
                        Text(
                          '2个',
                          style: StylesUtils.customTextStyle(
                            color: ColorsUtils.colorFf64,
                            fontSize: StylesUtils.fontSize16,
                            fontWeight: FontWeight.w700,
                          ),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.symmetric(horizontal: 5),
                    child: Container(
                      height: 2,
                      color: HexColor(ColorsUtils.colorF5f5),
                    ),
                  ),
                  Container(
                    padding: const EdgeInsets.only(top: 15),
                    alignment: Alignment.centerRight,
                    child: Wrap(
                      spacing: 15,
                      alignment: WrapAlignment.end,
                      crossAxisAlignment: WrapCrossAlignment.center,
                      children: [
                        Text.rich(TextSpan(children: [
                          TextSpan(
                              text: '共优惠 ',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color7979)),
                          TextSpan(
                              text: '￥7',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.colorFf64))
                        ])),
                        Text.rich(TextSpan(children: [
                          TextSpan(
                              text: '应付款 ',
                              style: StylesUtils.customTextStyle(
                                  fontWeight: FontWeight.w700,
                                  color: ColorsUtils.color0000)),
                          TextSpan(
                              text: '￥104',
                              style: StylesUtils.customTextStyle(
                                  fontWeight: FontWeight.w700,
                                  color: ColorsUtils.color0000,
                                  fontSize: StylesUtils.fontSize18))
                        ]))
                      ],
                    ),
                  )
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(left: (Get.width - 345) / 2, top: 10),
              width: 345,
              padding: const EdgeInsets.all(15),
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(10)),
              child: Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '配送方式',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color7979,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ),
                        Expanded(
                            child: Container(
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '平台转送',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color0000,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ))
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '预计送达',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color7979,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ),
                        Expanded(
                            child: Container(
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '12月07日 18:10',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color0000,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ))
                      ],
                    ),
                  ),
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      Container(
                        width: 100,
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '收货地址',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color7979,
                              fontSize: StylesUtils.fontSize15),
                        ),
                      ),
                      Expanded(
                          child: Container(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '李四收，136****5678，北海市海城区北海大道96号龙岭花园12栋',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color0000,
                              fontSize: StylesUtils.fontSize15,
                              lineHeight: 1.4),
                        ),
                      ))
                    ],
                  )
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(left: (Get.width - 345) / 2, top: 10),
              width: 345,
              padding: const EdgeInsets.all(15),
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(10)),
              child: Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Container(
                          width: 80,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '餐具数量',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color7979,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ),
                        Expanded(
                            child: Container(
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '无需餐具',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color0000,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ))
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Container(
                          width: 80,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '发票',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color7979,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ),
                        Expanded(
                            child: Container(
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '个人',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color0000,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ))
                      ],
                    ),
                  ),
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      Container(
                        width: 80,
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '备注',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color7979,
                              fontSize: StylesUtils.fontSize15),
                        ),
                      ),
                      Expanded(
                          child: Container(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '多要几副手套，聚会客人比较多，谢谢老板好人',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color0000,
                              fontSize: StylesUtils.fontSize15,
                              lineHeight: 1.4),
                        ),
                      ))
                    ],
                  )
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(left: (Get.width - 345) / 2, top: 10),
              width: 345,
              padding: const EdgeInsets.all(15),
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(10)),
              child: Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Container(
                          width: 80,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '订单号',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color7979,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ),
                        Expanded(
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Container(
                                height: 20,
                                alignment: Alignment.centerLeft,
                                child: Text(
                                  '12232964103521',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color0000,
                                      fontSize: StylesUtils.fontSize15),
                                ),
                              ),
                              GestureDetector(
                                onTap: () {},
                                child: Container(
                                  constraints: const BoxConstraints.expand(
                                      width: 50, height: 25),
                                  decoration: BoxDecoration(
                                      borderRadius: BorderRadius.circular(13),
                                      border: Border.all(
                                          color:
                                              HexColor(ColorsUtils.colorE4e4))),
                                  alignment: Alignment.center,
                                  child: Text(
                                    '复制',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color0000,
                                        fontSize: StylesUtils.fontSize12),
                                  ),
                                ),
                              ),
                            ],
                          ),
                        )
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Container(
                          width: 80,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '交易快照',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color7979,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ),
                        Expanded(
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text(
                                '发生争议时，可作为判断依据',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color0000,
                                    fontSize: StylesUtils.fontSize15),
                              ),
                              GestureDetector(
                                onTap: () {},
                                child: Icon(
                                  CupertinoIcons.chevron_forward,
                                  size: 12,
                                  color: HexColor(ColorsUtils.color9999),
                                ),
                              ),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Container(
                          width: 80,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '创建时间',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color7979,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ),
                        Expanded(
                            child: Container(
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '2024-07-14 12:18:19',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color0000,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ))
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 20),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Container(
                          width: 80,
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '付款时间',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color7979,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ),
                        Expanded(
                            child: Container(
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '2024-07-14 12:25:19',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color0000,
                                fontSize: StylesUtils.fontSize15),
                          ),
                        ))
                      ],
                    ),
                  ),
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      Container(
                        width: 80,
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '支付方式',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color7979,
                              fontSize: StylesUtils.fontSize15),
                        ),
                      ),
                      Expanded(
                        child: Container(
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '微信支付',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color0000,
                                fontSize: StylesUtils.fontSize15,
                                lineHeight: 1.4),
                          ),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

  void openMenu(BuildContext context) {
    controller.menu ??= PopupMenu(
        context: context,
        content: Container(
          color: HexColor(ColorsUtils.color3333).withOpacity(0.898039),
          child: Padding(
            padding: const EdgeInsets.symmetric(vertical: 10),
            child: Column(
              children: [
                GestureDetector(
                  onTap: () {
                    Get.log('ok');
                    controller.menu?.dismiss();
                  },
                  child: Container(
                    width: 90,
                    height: 40,
                    alignment: Alignment.center,
                    child: Text(
                      '分享订单',
                      style: StylesUtils.customTextStyle(
                        fontSize: StylesUtils.fontSize15,
                      ),
                    ),
                  ),
                ),
                GestureDetector(
                  onTap: () {
                    controller.menu?.dismiss();
                  },
                  child: Container(
                    width: 90,
                    height: 40,
                    alignment: Alignment.center,
                    child: Text(
                      '联系客服',
                      style: StylesUtils.customTextStyle(
                        fontSize: StylesUtils.fontSize15,
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
        config: const MenuConfig(
            type: MenuType.custom,
            itemHeight: 100,
            itemWidth: 90,
            borderRadius: BorderRadius.all(Radius.circular(5))),
        onDismiss: () {
          Get.log('onDiss');
        });
    controller.menu!.show(widgetKey: controller.widgetKey);
  }

  void cancelOrder() {
    Get.bottomSheet(
        Container(
          height: 420,
          decoration: const BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(15), topRight: Radius.circular(15))),
          child: Column(
            children: [
              Stack(
                children: [
                  Container(
                      padding: const EdgeInsets.only(
                          top: 15, right: 2, left: 2, bottom: 2),
                      alignment: Alignment.center,
                      child: Text(
                        '取消订单',
                        softWrap: true,
                        style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color0000,
                            fontWeight: FontWeight.w700,
                            fontSize: StylesUtils.fontSize16),
                      )),
                  Positioned(
                      top: 15,
                      left: 20,
                      child: GestureDetector(
                          onTap: Get.back,
                          child: Icon(
                            CupertinoIcons.xmark,
                            size: 20,
                            color: HexColor(ColorsUtils.color6666),
                          )))
                ],
              ),
              Container(
                alignment: Alignment.centerLeft,
                margin: const EdgeInsets.only(top: 10),
                padding: const EdgeInsets.symmetric(horizontal: 15),
                color: Colors.white,
                child: Container(
                  width: 350,
                  height: 25,
                  alignment: Alignment.centerLeft,
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(2),
                      color: HexColor(ColorsUtils.colorF9f9)),
                  child: Text(
                    '取消后无法恢复，优惠券、红包可退回，请在有效期内使用。',
                    softWrap: true,
                    style: StylesUtils.customTextStyle(
                        color: ColorsUtils.color7979,
                        fontSize: StylesUtils.fontSize12),
                  ),
                ),
              ),
              Container(
                margin: const EdgeInsets.only(top: 10),
                alignment: Alignment.centerLeft,
                padding: const EdgeInsets.symmetric(horizontal: 15),
                child: Text(
                  '请选择取消订单原因 ',
                  style: StylesUtils.customTextStyle(
                      fontSize: StylesUtils.fontSize15,
                      color: ColorsUtils.color7979),
                ),
              ),
              Container(
                  margin: const EdgeInsets.only(
                    top: 10,
                  ),
                  padding: const EdgeInsets.symmetric(horizontal: 15),
                  child: Column(
                    children: controller.selecteds
                        .asMap()
                        .map((key, value) => MapEntry(
                            key,
                            Obx(() => GestureDetector(
                                  onTap: () {
                                    controller.selectedIndex.value = key;
                                  },
                                  child: SizedBox(
                                    height: 40,
                                    child: Row(
                                      mainAxisAlignment:
                                          MainAxisAlignment.spaceBetween,
                                      children: [
                                        Text(
                                          value,
                                          style: StylesUtils.customTextStyle(
                                              fontSize: StylesUtils.fontSize15,
                                              color: ColorsUtils.color0000),
                                        ),
                                        controller.selectedIndex.value == key
                                            ? Icon(
                                                CupertinoIcons
                                                    .checkmark_alt_circle_fill,
                                                size: 22,
                                                color: HexColor(
                                                    ColorsUtils.colorFf64),
                                              )
                                            : Icon(
                                                CupertinoIcons.circle,
                                                size: 22,
                                                color: HexColor(
                                                    ColorsUtils.colorCccc),
                                              )
                                      ],
                                    ),
                                  ),
                                ))))
                        .values
                        .toList(),
                  )),
              Container(
                margin: const EdgeInsets.only(top: 20),
                alignment: Alignment.center,
                child: Container(
                  constraints:
                      const BoxConstraints.expand(width: 315, height: 45),
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(23),
                      gradient: LinearGradient(
                          colors: [
                            ///linear-gradient(90deg, rgba(255, 153, 0, 1) 0%, rgba(255, 153, 0, 1) 0%, rgba(254, 70, 1, 1) 100%, rgba(254, 70, 1, 1) 100%)
                            ColorsUtils.rgba(255, 153, 0, 1),
                            ColorsUtils.rgba(255, 153, 0, 1),
                            ColorsUtils.rgba(254, 70, 1, 1),
                            ColorsUtils.rgba(254, 70, 1, 1)
                          ],
                          stops: const [
                            0,
                            0,
                            1,
                            1
                          ],
                          transform:
                              GradientRotation(RadianUtils.angleToRadian(90)))),
                  child: GestureDetector(
                    onTap: () {
                      Get.back();
                      // Get.engine.addPostFrameCallback((_) {
                      //   Get.toNamed(Routes.orderPaymentSuccess);
                      // });
                    },
                    child: Text(
                      '确定取消订单',
                      style: StylesUtils.customTextStyle(
                          fontSize: StylesUtils.fontSize16),
                    ),
                  ),
                ),
              )
            ],
          ),
        ),
        barrierColor: ColorsUtils.rgba(0, 0, 0, 0.298039215686275),
        backgroundColor: Colors.white,
        isScrollControlled: true,
        elevation: 0);
  }
}
